Skip to content

feat: add pinned threads to sidebar (pin/unpin, persisted, menu & UI)#109

Merged
Dimillian merged 5 commits intomainfrom
codex/github-mention-feat-add-pin-option-to-thread-context-men
Jan 19, 2026
Merged

feat: add pinned threads to sidebar (pin/unpin, persisted, menu & UI)#109
Dimillian merged 5 commits intomainfrom
codex/github-mention-feat-add-pin-option-to-thread-context-men

Conversation

@Dimillian
Copy link
Owner

Motivation

  • Let users pin important root threads so they stay at the top of the sidebar separate from regular threads.
  • Persist pin state across restarts and make pin/unpin available from the thread context menu.

Description

  • Added safe localStorage helpers and pin APIs (pinThread, unpinThread, isThreadPinned, getPinTimestamp) in src/features/threads/hooks/useThreads.ts, plus auto-unpin on archive and cross-tab sync via the storage event.
  • Split thread row generation into pinned vs unpinned sections by changing useThreadRows to return pinnedRows and unpinnedRows and accept workspaceId + getPinTimestamp so pin state influences ordering (src/features/app/hooks/useThreadRows.ts).
  • Render pinned rows, a separator, and a 📌 icon for pinned root threads in ThreadList, and pass canPin to the context menu trigger (src/features/app/components/ThreadList.tsx).
  • Plumb pin helpers through Sidebar, WorktreeSection, and layout wiring (useSidebarMenus, useLayoutNodes, App.tsx) and add Pin/Unpin items to the thread context menu (src/features/app/hooks/useSidebarMenus.ts, src/features/app/components/Sidebar.tsx, src/features/app/components/WorktreeSection.tsx, src/features/layout/hooks/useLayoutNodes.tsx).
  • Added simple styles for the pin icon and the separator in src/styles/sidebar.css.

Testing

  • Ran npm run lint; lint completed but the environment prints a non-blocking TypeScript-ESLint compatibility warning for TypeScript 5.8.3 (no lint errors remain after fixes).
  • Ran npm run typecheck; TypeScript typecheck succeeded with no errors.

Codex Task

@Dimillian
Copy link
Owner Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca29b14ba9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 77 to +81
return {
rows,
totalRoots: roots.length,
hasMoreRoots: roots.length > visibleRootCount,
pinnedRows,
unpinnedRows,
totalRoots: unpinnedRoots.length,
hasMoreRoots: unpinnedRoots.length > visibleRootCount,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep expand/pagination available when many threads are pinned

Because totalRoots now excludes pinned roots, the “More…” toggle in ThreadList (which only renders when totalThreadRoots > 3) can disappear even when the workspace still has more threads to page in (e.g., the user pins most of the first page so unpinnedRoots.length <= 3 while nextCursor is still non-null). In that case there is no way to expand, so the “Load older…” button never becomes reachable and older threads become inaccessible. This regression only shows up once many roots are pinned and the server still has additional pages.

Useful? React with 👍 / 👎.

@Dimillian Dimillian merged commit 114e284 into main Jan 19, 2026
2 checks passed
gersmann pushed a commit to gersmann/codex-monitor-web that referenced this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant